home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / misc / vhlogger_v2.lzh / was.rexx < prev   
OS/2 REXX Batch file  |  1992-07-21  |  6KB  |  216 lines

  1. /* $VER: was.rexx 1.00 (060792) */
  2. /* Version     1 - 07/05/92 Vince Herried ka8cte */
  3. /* purpose     check for Worked All States elegibility */
  4. /* arguments   open - vhlogger is already running and the data base file open*/
  5. /*           debug - turns on trace, kind o verbose         */
  6.  
  7. arg parms
  8. test='n'
  9.  
  10. say "was.rexx - this program starts up 'vhlogger' and then reads"
  11. say "through the data base looking for contacts for which you have"
  12. say "received QSL cards.  Each time one is found from a new state"
  13. say "That call is displayed.  If at the end of your data base it has"
  14. say "found 50, it will display those states that you still need to get"
  15. say "your Worked all States award from the ARRL."
  16. say " "
  17. say ""
  18.  
  19. modes= "CW SSB FM AM AMTOR RTTY PACKET ASCII FAX SSTV FSTV other"
  20. mode_search=0
  21. do until(ans = 'Y' | ans = 'N')
  22.    say "Are you interested in a particular mode (enter y, n, or ?)"
  23.    pull ans
  24.    if ans = '?' then do
  25.       say "By mode, I mean SSB, CW, packet ..."
  26.       say ""
  27.    end
  28. end
  29.  
  30. if ans = 'Y' then do
  31.    do until(mode_search ~= 0)
  32.       say "Here is a list of modes, enter one:"
  33.       say  modes
  34.       pull ans
  35.       mode_search = find(modes,ans)
  36.    end
  37. end
  38.  
  39. bands = "160M 80M 40M 30M 20M 17M 15M 12M 10M 6M 2M 1.25M 70CM 33CM 23CM other"
  40. band_search=0
  41. do until(ans = 'Y' | ans = 'N')
  42.    say "Are you interested in a particular band (enter y, n or ?)"
  43.    pull ans
  44.    if ans='?' then
  45.       say "By band, I mean what amateur band, eg 160M 20M 2M etc."
  46. end
  47.  
  48. if ans = 'Y' then do
  49.    do until(band_search ~= 0)
  50.       say "Here is a list of bands, enter one"
  51.       say bands
  52.       pull ans
  53.       band_search=find(bands,ans)
  54.    end
  55. end
  56.  
  57. say ""
  58.  
  59. options results
  60.  
  61.  
  62. /* here is a list of states by call area */
  63.  
  64. states.0="CO IA KS MN MO NE ND SD "
  65. states.1="CT ME MA NH RI VT "
  66. states.2="NJ NY "
  67. states.3="DE MD PA "
  68. states.4="AL FL GA KY NC SC TN VA "
  69. states.5="AR LA MS NM OK TX "
  70. states.6="CA "
  71. states.7="AZ ID MT NV OR UT WA WY "
  72. states.8="MI OH WV "
  73. states.9="IL IN WI "
  74. states.10="HI AK "
  75.  
  76. state_list=states.0 || states.1 || states.2 || states.3 || states.4 || states.5 ||,
  77.       states.6 || states.7 || states.8 || states.9 || states.10
  78.  
  79.  
  80. if (find(parms,"DEBUG") ~= 0) then do
  81.    trace('r') /* debugging trace required? */
  82.    test='y'
  83. end
  84.  
  85. if (find(parms,"OPEN") ~= 0) then open='y'    /* already open? */
  86.    else open='n'
  87.  
  88. /* search the data base for all 50 calls  */
  89.  
  90. WaitForPort "vhlogger"
  91. if RC ~= 0 then open='n'         /* my program doesn't seem to fully close*/
  92.                  /* the arexx port.  if not open then program*/
  93.                  /* is not running.  If port is open pgm may */
  94.                  /* or may not be running, can't tell */
  95.  
  96. if open = 'n' then do            /* data base program not running yet */
  97.    address "COMMAND"
  98.    "run vhlogger"
  99.       WaitForPort "vhlogger"
  100.       address "vhlogger"
  101.       "back"               /* window to back */
  102.       "open vhlog"         /* open the input file. */
  103.       if rc ~= 0 then do
  104.     say "open failed, possibly invalid file name? ending!"
  105.     "quit"             /* stop the music, er program */
  106.     exit(8)
  107.       end
  108.       open = 'y'
  109. end               /* if open = 'n' */
  110.  
  111. gotone='n'
  112.  
  113. address "vhlogger"
  114.  
  115. cardno=0
  116.  
  117. do while(getone())
  118.  
  119.   parse var result callsign ';' name ';' date ';' stime ';' etime ';' rsts ';',
  120.       rstr ';' address ';' city ';' state ';' zip ';' comment ';' srh ';',
  121.       xband ';' xpower ';' xantenna ';' xmode junk
  122.  
  123.   if substr(srh,2,2) ~= 'YY' then iterate     /* no qsl received from him */
  124.                          /* also required to be made from */
  125.                          /* your home QTH */
  126.  
  127. xmode = strip(xmode,'T','.')                 /* strip trailing period? */
  128.  
  129.  
  130. /* now check for a specific mode requirement    */
  131.  
  132.    if mode_search ~= 0 then if xmode ~= mode_search then iterate
  133.  
  134. /* now check for a specific band requirement    */
  135.  
  136.    if band_search ~= 0 then if xband ~= band_search then iterate
  137.  
  138.  
  139.    i = index(state_list,state)
  140.    if i = 0 then iterate  /* already got this state */
  141.  
  142.    state_list = overlay("  ",state_list,i,2)
  143.  
  144.  
  145.    cardno=cardno+1                 /* count it */
  146.  
  147.    card.cardno=state callsign             /* save state & call sign */
  148.  
  149.    say card.cardno "from" state "with" 50-cardno "still needed.",
  150.       "Mode" xmode "Band" xband
  151.  
  152.    if cardno > 49 then leave             /* got em all, wrap it up*/
  153. end
  154.  
  155. say ""
  156. if cardno < 50 then do
  157.    say "You don't have all 50 states"
  158.    say "you are missing cards from" space(state_list,1)
  159. end
  160. else do
  161.    say "Congratulations you've got one from each of the 50 states"
  162.    say "send them to ARRL for your award/certificate."
  163. end
  164.  
  165. say ""
  166. do until(ans = 'Y' | ans = 'N')
  167.    say "Do want a printed copy of the above information (enter y or n)?"
  168.    pull ans
  169. end
  170.  
  171. if ans = 'Y' then do
  172.    if (open('printer','PRT:','W') = 0) then do
  173.      say "Open of printer failed, ending"
  174.      exit(16)
  175.    end
  176.    if cardno < 50 then do
  177.       x=writeln("printer","Missing cards from the following states");
  178.       do i=1 to words(state_list)
  179.      x=writech("printer",word(state_list,i) " ");
  180.      if i//15=0 then x=writeln("printer",' ');
  181.       end
  182.       x= writeln("printer",' ');
  183.       x= writeln("printer",' ');
  184.    end
  185.    writeln("printer","Confirmed QSLs from the following:")
  186.    do i=1 to cardno
  187.       x= writech("printer",left(card.i,12))
  188.       if i//5=0 then x=writeln("printer",' ');
  189.    end
  190.    x= writeln("printer",' ');    /* some printers req this to finish the output*/
  191. end
  192.  
  193.  
  194. do until(ans='Y' | ans='N')
  195.    say "Do you want to leave VHlogger running (enter y or n)?"
  196.    pull ans
  197. end
  198.  
  199. if ans = 'N' then do
  200.    "close"
  201.    "quit"
  202. end
  203.  
  204. exit(0)
  205.  
  206.  
  207. getone:
  208.  
  209. if gotone='n' then
  210.    "first"                 /* go to top of the file */
  211. else "next"                /* else go the next entry */
  212. gotone='y'
  213. if rc=0 then return(1)
  214. else return(0)
  215.  
  216.